#pragma once
#include "epoll.h"
#include<memory>
#include<functional>

class Epoll;

class Channel
{
private:
    std::shared_ptr<Epoll> ep;
    int fd;
    uint32_t events;
    uint32_t revents;
    bool inEpoll;
    std::function<void()> cb;
public:
    Channel(int _fd, uint32_t _events, std::function<void()> _cb);
    Channel(std::shared_ptr<Epoll> _ep, int _fd, uint32_t _events, std::function<void()> _cb);
    ~Channel();
    void enableReading();
    int getFd();
    uint32_t getEvents();
    bool getInEpoll();
    void setInEpoll();
    void handleEvent();
    // void setCallback(std::function<void()>);
};

